package cn.tedu.blog.server.controller.api;

import cn.tedu.blog.server.pojo.vo.LinkListItemVO;
import cn.tedu.blog.server.service.ILinkService;
import cn.tedu.blog.server.utils.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/api/link")
@Api(tags = "前台友链查询模块")
public class ApiLinkController {

    @Autowired
    private ILinkService linkService;

    @ApiOperation("友链列表")
    @GetMapping("/newest")
    public JsonResult list() {
        log.debug("接收到查询友链列表的请求");
        List<LinkListItemVO> list = linkService.newList();
        return JsonResult.ok(list);
    }
}
